-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Frames Client #213
feat: Frames Client #213
Conversation
Added Frames package port from JS Bumped protos library
4f19e12
to
4ec386d
Compare
Updated handling Added tests
Fixed lint on builds
Fixed lint on builds
val state: String? | ||
) | ||
|
||
data class GetMetadataResponse( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's going to make usability much better if this also included the frameInfo
field which does a lot of the parsing of the extracted tags for you and assembles it into a nice object. Could happen in a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really great. Mostly all nits to keep it inline with the rest of the kotlin sdk.
Really don't know how to review the ProxyClient
. Kind of feels like something that might have been better suited for GRPC. But I might be missing it's use case.
library/src/main/java/org/xmtp/android/library/frames/FramesClient.kt
Outdated
Show resolved
Hide resolved
library/src/main/java/org/xmtp/android/library/frames/FramesClient.kt
Outdated
Show resolved
Hide resolved
library/src/main/java/org/xmtp/android/library/frames/FramesClient.kt
Outdated
Show resolved
Hide resolved
} | ||
is ConversationActionInputs.Dm -> { | ||
val dmInputs = inputs.conversationInputs.inputs | ||
val conversationTopic = dmInputs.conversationTopic ?: throw InvalidArgumentsError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we throw an XMTPException instead. This helps integrators catch exceptions being thrown from our SDK easier.
val conversationTopic = dmInputs.conversationTopic ?: throw InvalidArgumentsError() | |
val conversationTopic = dmInputs.conversationTopic ?: throw XMTPException("No conversation topic") |
library/src/main/java/org/xmtp/android/library/frames/FramesErrors.kt
Outdated
Show resolved
Hide resolved
library/src/main/java/org/xmtp/android/library/frames/OpenFramesProxy.kt
Outdated
Show resolved
Hide resolved
library/src/androidTest/java/org/xmtp/android/library/FramesTest.kt
Outdated
Show resolved
Hide resolved
if (inputText != null) { | ||
frame.inputText = inputText | ||
} | ||
if (state != null) { | ||
frame.state = state | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you null check here? Seems like state and inputText are okay with null being set?
if (inputText != null) { | |
frame.inputText = inputText | |
} | |
if (state != null) { | |
frame.state = state | |
} | |
frame.inputText = inputText | |
frame.state = state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not, it errors if the state is null or inputText is null, instead they use the default values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh okay now I see you did this in iOS
let state = inputs.state ?? ""
Then to clean this up what about this
if (inputText != null) { | ||
frame.inputText = inputText | ||
} | ||
if (state != null) { | ||
frame.state = state | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh okay now I see you did this in iOS
let state = inputs.state ?? ""
Then to clean this up what about this
val frameUrl = inputs.frameUrl | ||
val buttonIndex = inputs.buttonIndex | ||
val inputText = inputs.inputText | ||
val state = inputs.state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val state = inputs.state | |
val state = inputs.state ?: "" |
val opaqueConversationIdentifier = buildOpaqueIdentifier(inputs) | ||
val frameUrl = inputs.frameUrl | ||
val buttonIndex = inputs.buttonIndex | ||
val inputText = inputs.inputText |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val inputText = inputs.inputText | |
val inputText = inputs.inputText ?: "" |
Just to match iOS and remove the null check inline
Added Frames package port from JS
Bumped protos library